package com.erification.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.erification.web.dao.GroupDao;
import com.erification.web.model.Group;
import com.erification.web.service.GroupService;
@Service("groupService")
public class GroupServiceImpl implements GroupService {
	@Resource
	private GroupDao groupDao;
	
	@Override
	public void save(Group group) {
		groupDao.save(group);
	}

	@Override
	public void deleteGroup(long id) {
		groupDao.delete(id);
	}

	@Override
	public List<Group> getAll(long user_id) {
		return groupDao.getAll(user_id);
	}

	@Override
	public Group get(long id) {
		return groupDao.get(id);
	}

	@Override
	public void modifyGroup(long group_id, Group newGroup) {
		Group beforeModify = groupDao.get(group_id);
		beforeModify.setGroupName(newGroup.getGroupName());
		beforeModify.setAddress(newGroup.getAddress());
		beforeModify.setCelephone(newGroup.getCelephone());
		beforeModify.setTrueName(newGroup.getTrueName());
		beforeModify.setEmail(newGroup.getEmail());
		groupDao.update(beforeModify);
	}

}
